package org.six11.olive3.server;

import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static org.six11.olive3.server.WebActionServlet.*;

/**
 * 
 *
 * @author Gabe Johnson <johnsogg@cmu.edu>
 */
public class PlayHandler extends WebActionHandler {

  public PlayHandler(String jspPage, WebActionServlet webActionServlet) {
    super(jspPage, webActionServlet);
  }

  public void service(HttpServletRequest req, HttpServletResponse resp, ServletContext context)
      throws ServletException, IOException {
    String suid = (String) req.getSession().getAttribute(SESSION_USER_ID);
    Map<String, String> potential = getPotential(new Integer(suid).intValue());
    req.setAttribute("rate", potential.get("rate"));
    req.setAttribute("sketch", potential.get("sketch"));
    req.setAttribute("describe", potential.get("describe"));
    go(req, resp, context);
  }

}
